package com.light.applet.common.redis;

import lombok.Setter;

import java.util.concurrent.TimeUnit;

/**
 * @author 魏彪
 */
@Setter
public class StandardKeyPrefix implements KeyPrefix {

    private String prefix;

    private Integer timeout;

    private TimeUnit timeUnit;

    public StandardKeyPrefix(String prefix) {
        this(prefix, -1, null);
    }

    public StandardKeyPrefix(String prefix, Integer timeout, TimeUnit timeUnit) {
        this.prefix = prefix;
        this.timeout = timeout;
        this.timeUnit = timeUnit;
    }

    @Override
    public String prefix() {
        return this.prefix;
    }

    @Override
    public int timeout() {
        return this.timeout;
    }

    @Override
    public TimeUnit timeUnit() {
        return this.timeUnit;
    }
}
